/*
 * @author       :成家杰
 * @date         :2022-06-22 09:19:28
 * @Description  : com.tj.controller
 * @version      : 1.0
 */


package com.tj.controller;

import com.tj.pojo.Hospital;
import com.tj.pojo.OverAllResult;
import com.tj.service.HospitalService;
import com.tj.service.OverAllResultService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/OverAllResult")
public class OverAllResultController {
    @Autowired
    private OverAllResultService overAllResultService;
    //单个查询id查询
    @RequestMapping("/getOverAllResultById")
    public Map<String, Object> getOverAllResultDetail(@RequestParam Integer id) throws Exception {
        List<OverAllResult> overAllResult = overAllResultService.selectByOverAllResultId(id);
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("status", "1");
        map.put("overAllResult", overAllResult);
        return map;
    }
    
    //查询所有数据
    @RequestMapping("/getOverAllResultList")
    public Map<String, Object> getOverAllResultList() throws Exception {
        List<OverAllResult> overAllResult = overAllResultService.selectAll();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("status", "1");
        map.put("overAllResult",overAllResult);
        return map;
    }
    
    //增加数据
    @RequestMapping("/insertOverAllResult")
        public Map<String, Object> insertOverAllResult(@RequestParam String title,@RequestParam String content,@RequestParam Integer orderId) throws Exception {
        int overAllResult = overAllResultService.insert(title, content, orderId);
        Map<String, Object> map = new HashMap<>();
        map.put("status", "1");
        map.put("overAllResult", overAllResult);
        return map;
        
    }
    
    //删除数据
    @RequestMapping("/deletOverAllResult")
    public Map<String, Object> delete(@RequestParam Integer id) throws Exception {
        int  overAllResult = overAllResultService.delete(id);
        Map<String, Object> map = new HashMap<>();
        map.put("status", "0");
        map.put("overAllResult",overAllResult);
        return map;
    }
    
    //更新数据
    @RequestMapping("/updateOverAllResult")
    public Map<String, Object> updateHospital(@RequestParam Integer id,@RequestParam String title,@RequestParam String content,@RequestParam int orderId) throws Exception {
        int overAllResult = overAllResultService.update(id,title, content, orderId);
        Map<String, Object> map = new HashMap<>();
        map.put("status", "1");
        map.put("overAllResult",overAllResult);
        return map;
    }
    
    //按name模糊查询
    @RequestMapping("/Fuzzyquery")
    public Map<String, Object> Fuzzyquery(@RequestParam String title) throws Exception {
        List<OverAllResult> overAllResult = overAllResultService.Fuzzyquery(title);
        Map<String, Object> map = new HashMap<>();
        map.put("status", "1");
        map.put("overAllResult",overAllResult);
        return map;
    }
}
